
/**
 * 图片淡入淡出浏览插件
 * @author bing.peng
 */
(function($){

$.fn.skim = function(controlOptions){
	var settings = {
		timer:5000,		// 定时器，毫秒 
		speed:1		// 完成动画的时长，毫秒
	};
	controlOptions = controlOptions || {};
	$.extend(settings, controlOptions);
	
	return this.each(function(){
		 $(this).addClass("zonge-skim");
		 var objs = $(".zonge-skim img");
		 objs.hide();
		 var len = objs.length;
		 var i = 0;
		 $(objs[i]).fadeIn( settings.speed );
		 i++;
		 // 定时调用
		 setInterval(function(){
			if( i == 0 ) {
				$(objs[i]).fadeIn(settings.speed);
				i++;
			}
			else if( i == (len-1) ) {
				$(objs[i-1]).fadeOut(settings.speed);
				$(objs[i]).fadeIn(settings.speed);
				i = 0;
			}
			else {
				$(objs[i-1]).fadeOut(settings.speed);
				$(objs[i]).fadeIn(settings.speed);
				i++;
			}
		 }, settings.timer);
	});
};
	
})(jQuery);